import{
    showStuAll,findStuById
} from  '../service/index'
export default{
    namespaced: true,

    state:{
        // 修改弹框属性
        dialogVisible:false,
        // 添加弹框属性
        dialogAddVisible:false,
        stuList:[],//查询所有学生返回的集合

        stuBean:{},//查询学生返回的对象
        
    },
    mutations:{//改变state的方法
        setDialogAddVisible(state,dialogAddVisible){
            state.dialogAddVisible = dialogAddVisible
        },
        setDialogVisible(state,dialogVisible){
            state.dialogVisible = dialogVisible
        },
        setStuList(state,stuList){
            state.stuList = stuList
        },
        setStuBean(state,stuBean){
            state.stuBean = stuBean
        },
        
        
    },
    actions: {//异步方法
        async showStu(context){
           
            let response = await showStuAll();
            console.log(response);
            context.commit("setStuList",response.data)
          },

          async findStu(context,id){
           
            let response = await findStuById(id);

            context.commit("setStuBean",response.data)
          }
    },
    getters:{//对数据进行处理的逻辑方法，

    },
}